const {resolve,toNamespacedPath} = require('path')
const fs = require('fs')
const getRouter = (path = resolve('./')) => {
    // ##BEGIN## 代码已加密
    const list = fs.readdirSync(path)
    console.log(list,__dirname)
    const result = 
`
export default new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [
${list.map(file => 
`
{
    path: '/${file.replace('.vue','')}',
    name: '${file.replace('.vue','')}',
    component: () => import('./views/${file}')
},
`
).join('')}
    ]
})`
    console.log(result)
    return result

// ##END##
}
let dir =resolve('./__tests__/data')
console.log(dir)
getRouter(dir)
module.exports = getRouter
